package com.white.hot.controller.jpush;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.white.hot.constant.ConstantInfo;
import com.white.hot.dto.resp.BaseResp;

@Controller
@RequestMapping("/jpush")
public class JPushController
{

	private static final String APPKEY = "7450750591afc5f40e8e01b0";
	private static final String MASTER_SECRET = "65a5a36648de0e0436f5dd25";
//	private static final String APPKEY = "8bbb05aba58e07ebf169b15e";
//	private static final String MASTER_SECRET = "cebd321365c9508d39b8c10c";
	
	@RequestMapping("/notifyOne")
	@ResponseBody
	private Object nofityOne()
	{
		BaseResp br = new BaseResp();
		if (JPushManager.getInstance(MASTER_SECRET,APPKEY).sendAndroidBroadcast("安卓", "极光推送",new String[]{}, new String[]{}))
		{
			br.setStatus(ConstantInfo.RSC_SUCCESS);
			br.setInfo(ConstantInfo.RSS_SUCCESS);
		} else
		{
			br.setStatus(ConstantInfo.RSC_INNER_ERROR);
			br.setInfo(ConstantInfo.RSS_INNER_ERROR);
		}
		return br;
	}
	
	@RequestMapping("/notifySingleOne")
	@ResponseBody
	private Object nofitySingleOne()
	{
		BaseResp br = new BaseResp();
		if (JPushManager.getInstance(MASTER_SECRET,APPKEY).sendAndroidBroadcast("安卓", "极光推送",new String[]{"tag1"}, new String[]{}))
		{
			br.setStatus(ConstantInfo.RSC_SUCCESS);
			br.setInfo(ConstantInfo.RSS_SUCCESS);
		} else
		{
			br.setStatus(ConstantInfo.RSC_INNER_ERROR);
			br.setInfo(ConstantInfo.RSS_INNER_ERROR);
		}
		return br;
	}
}
